<?php

/**
 * AnoModelo form base class.
 *
 * @method AnoModelo getObject() Returns the current form's model object
 *
 * @package    toyomotor
 * @subpackage form
 * @author     Ing. Roberto Hernández De La Luz at Netosfera
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseAnoModeloForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_ano_modelo' => new sfWidgetFormInputHidden(),
      'id_ano'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ano'), 'add_empty' => false)),
      'id_modelo'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Modelo'), 'add_empty' => false)),
      'tipo_vehiculo' => new sfWidgetFormChoice(array('choices' => array('Comercial' => 'Comercial', 'Carga' => 'Carga', 'Pasajeros' => 'Pasajeros'))),
    ));

    $this->setValidators(array(
      'id_ano_modelo' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id_ano_modelo')), 'empty_value' => $this->getObject()->get('id_ano_modelo'), 'required' => false)),
      'id_ano'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Ano'))),
      'id_modelo'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Modelo'))),
      'tipo_vehiculo' => new sfValidatorChoice(array('choices' => array(0 => 'Comercial', 1 => 'Carga', 2 => 'Pasajeros'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('ano_modelo[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AnoModelo';
  }

}
